package com.westos.echufang.config.handler;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RegistIntercepterHandle implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Object regist = request.getSession().getAttribute("regist");
        if (regist==null){
            request.setAttribute("registError","请先注册");
            request.getRequestDispatcher("/toRegist").forward(request,response);
            return false;
        }else return true;

    }
}
